Skip to content

DwarfStar (antirez/ds4) as a backend: 1bit serve --device ds4 - #111

Merged
bong-water-water-bong merged 1 commit into
mainfrom
dwarfstar
Sep 26, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
dwarfstar

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

DwarfStar (MIT) is a native engine for a few large MoE models (DeepSeek V4/V4.1 Flash, GLM 5.x Flash, Qwen3.8-Flash-Next) in its own GGUF layouts, with first-class Strix Halo ROCm support and SSD expert streaming. Its GGUFs are the most downloaded DeepSeek V4.1 Flash files on HF (antirez/deepseek-v4.1-flash-gguf, 940k), and llama.cpp cannot load them. This adds it as a child backend, like ZINC.

  • third_party/ds4: antirez/ds4 0aaea5a238fb; bump-ds4.yml follows upstream main daily.
  • scripts/build-ds4.sh: builds a copy of the tree (the submodule stays clean) for rocm / cuda / metal / cpu. ROCm finds TheRock's SDK and passes its include/ with -isystem (clang otherwise searches it after /usr/include, where a distro HIP of another version shadows it). DS4_TEST=1 runs DwarfStar's model-free routed-MoE GPU test.
  • -DONEBIT_DS4=ON; 1bit serve --device ds4 with --ctx-size, --ssd-streaming, --ds4 PATH. A child now carries its own readiness path: ds4-server has no /health and opens its port once the model is loaded, so serve waits on /v1/models.
  • docs/dwarfstar.md; serve.md, README (repo XDNA: pin upstream amd/xdna-driver (and its XRT), build it privately, keep it current #12) and NOTICE.

Verified on Strix Halo (TheRock ROCm):

Check Result
DS4_TEST=1 scripts/build-ds4.sh build/ds4 rocm builds; routed-MoE MXFP4 test PASS (0 failures; variants bitwise OK); submodule clean
engine -DONEBIT_DS4=ON builds; ctest 7/7
serve --device ds4 -m <missing> DwarfStar's "cannot open model", then serve exits (backend did not become ready)
--ssd-streaming on another device refused

Not yet run: a full model. DeepSeek V4 Flash Q2 is 81 GiB on disk and needs about that much free memory; the box has 89 GB of disk and ~60 GB of memory free while other work runs. Hold the merge until it answers a chat through serve --device ds4.

🤖 Generated with Claude Code

DwarfStar is a native engine for a few large MoE models (DeepSeek V4/V4.1
Flash, GLM 5.x Flash, Qwen3.8-Flash-Next) in its own GGUF layouts, with
first-class Strix Halo ROCm support and SSD expert streaming. It runs as a
child of 1bit serve, like ZINC.

- third_party/ds4 pins antirez/ds4 0aaea5a238fb (MIT); bump-ds4.yml follows
  upstream main daily.
- scripts/build-ds4.sh builds a copy of the tree (the submodule stays clean)
  for rocm, cuda, metal or cpu. For ROCm it finds TheRock's SDK and passes its
  include/ with -isystem: clang otherwise searches it after /usr/include, where
  a distro HIP of another version shadows it. DS4_TEST=1 runs DwarfStar's
  model-free routed-MoE GPU test.
- ONEBIT_DS4 builds it; serve --device ds4 starts ds4-server (--ctx-size,
  --ssd-streaming, --ds4 PATH). A child now carries its own readiness path:
  ds4-server has no /health and opens its port once the model is loaded, so
  serve waits on its /v1/models.
- docs/dwarfstar.md; serve.md, README and NOTICE updated.

Verified on Strix Halo (TheRock ROCm): builds, routed-MoE test PASS, engine
ctest 7/7, the missing-model and --ssd-streaming error paths. A full model
(DeepSeek V4 Flash Q2, 81 GiB) is still to run: no room on the box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@context7

context7 Bot commented Sep 26, 2026

Copy link
Copy Markdown

Docs7 for 1bit-monster/engine

Result Status Action
Deployment ➖ Not used —
Content review ➖ Did not run. This site has no agent runs available this month. Wait for the monthly reset or check your Docs7 plan. —

Commit 1a9ca1d

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

12 - Partially compliant

Compliant requirements:

  • Pin the XDNA userspace stack to upstream amd/xdna-driver with commit 5d302c9
  • Build XRT and the XDNA shim plugin privately under a prefix
  • Exclude XRT's OpenCL layer (xocl) from the build
  • Use the build with -DONEBIT_XRT_ROOT=/root for the NPU lane
  • Keep the pin current with a daily job that opens a PR when upstream moves
  • Update docs/npu.md with a section on "The XDNA stack"

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incorrect ready path for ds4

The ds4 device uses /v1/models as its ready path, but this path may not be consistently available or correctly indicate model readiness across different versions of the ds4-server. This could lead to incorrect startup behavior or premature readiness signaling.

l.ready_path = "/v1/models";
Missing validation for ds4 model file

The code does not validate that the model file specified for the ds4 device actually exists or is a valid DwarfStar GGUF file before attempting to launch the ds4-server. This could lead to runtime errors or unexpected behavior if an invalid model is specified.

argv = {o.ds4.empty() ? default_ds4() : o.ds4, "-m", o.model,

@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) September 26, 2026 02:25
@bong-water-water-bong
bong-water-water-bong merged commit 53d74ce into main Sep 26, 2026
5 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the dwarfstar branch September 26, 2026 02:25
bong-water-water-bong added a commit that referenced this pull request Oct 20, 2026
…erver directly (#475)

* serve --print-backend: one hop from Lemonade for GGUF models

A chat request through Lemonade went lemond -> 1bit serve -> llama-server: two HTTP hops and
three processes. `1bit serve ... --print-backend` makes every check serve makes before a load
(architecture, memory admission, placement flags, recipes, the HRX environment) and prints the
llama-server it would start, on the port the caller passed, as one JSON line, then exits:
0 printed, 3 does not fit, 5 the route needs serve in the request path (NPU directory or
--device npu, onnx, ds4, --pm, --laya, --embed/--rerank). Lemonade's onebit recipe (fork branch
1bit/one-hop) starts that llama-server itself and forwards to it directly.

The plan adds --alias (Lemonade's name) and, for chat models, --cache-reuse 256 unless a recipe
set it; env lists only variables the caller's environment does not already set, so a user value
still wins as under serve.

What serve did on the request path moves into the backend:
- llama.cpp pin 680933de1 (fork branch 1bit/one-hop, on #111): /health answers 503 while the
  main loop is stalled with work queued, so Lemonade's BackendWatchdog probe resets a hung GPU,
  and llama-server exits on a lost GPU (serve's #466 signal);
- --strict-device stays GGML_HRX_STRICT in the backend.

third_party/lemonade pins the fork's 1bit/one-hop commit 23972095. registry/architectures.json
regenerated for the new llama.cpp pin.

Test: tests/print_backend.sh (ctest print_backend, no GPU): the JSON plan, port, alias,
--cache-reuse, ctx, the embedding role, exit 5 for NPU/--pm/--embed, exit 3 for a model that does
not fit, nothing started.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs/serve.md: one hop measured on Strix Halo; tools/onehop_bench.py

tools/onehop_bench.py starts a private lemond (own cache/config dirs and port), loads one onebit
model on HRX and measures load time, /tokenize and a 1-token chat via Lemonade and direct, time to
first token, and (one-hop arm) a pinned reload beside a second model and an unload + load.

Qwen3-4B-Instruct-2507 Q4_K_M on hrx, six rounds per arm, same llama-server for both: the serve
hop cost about 0.2 ms a request (/tokenize 0.53-0.64 ms -> 0.36-0.39 ms via Lemonade, 0.11-0.15 ms
direct); load 1.62 s -> 1.35-1.56 s; chat and time to first token unchanged within noise. A pinned
reload keeps the same llama-server and its warm program cache (seen length 106-119 ms); an unload +
load starts cold (228-236 ms).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Pin llama.cpp 3c24f910f (fork #112) and lemonade 80064ba7 (fork #15): the squash merges of the one-hop branches

Same trees as 680933de1 and 23972095, which the hw-gate run on this PR tested.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* registry: regenerated at llama.cpp 3c24f910f

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: bong-water-water-bong <bong-water-water-bong@1bit.gg>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant